<?php
namespace app\index\controller;
// namespace app\zw_admin\controller;
use \think\Controller;
use think\Db;
// use think\Controller;
use think\Session;
use think\Request;


class ClassController extends Controller
{
    public function index()
    {
		$brand_list = Db::name('brand')->select();
		// dump($brand_list);
		// exit;
		$this->assign('list',$brand_list);
		return $this->fetch('index');
    }



    public function brand_list()
    {
    	 // dump(input('param.'));
      //     exit;
      	$brand_id = input('param.brand_id');
      	$brand_list = Db::name('selling_brand')->where(['brand_id'=>$brand_id])->select();
      	// dump($brand_list);
      	// exit;
      	$selling_id = null;
      	foreach ($brand_list as $key => $value) {
      		// echo $value['selling_id'];
      		$selling_id .= "`selling_id`="."'".$value['selling_id']."'"." or ";
      	}
      	// exit;
      	$selling_id = rtrim($selling_id,'or ');
      	// echo $selling_id;
      	// exit;
  //     	$selling_id = $brand_list['selling_id'];

      	$selling_list = Db::name('selling')->where($selling_id)->select();
      	return $selling_list;
		// dump($selling_list);
    }
}
